package com.twu.biblioteca;

import java.util.Collection;
import java.util.List;

public class UserInterface {

    public void showWelcome() {
        System.out.println("Hello!");
    }

    public void showMenu() {
        System.out.println("Select an option: list | reserve | movies | membership | login | quit");
    }

    public void showMembershipInfo(User user) {
        System.out.println("ID / username: " + user.getId());
        System.out.println("name: " + user.getName());
        System.out.println("email address: " + user.getEmailAddress());
        System.out.println("phone number: " + user.getPhoneNumber());
    }

    public void showInvalidCommandMessage(String invalidCommand) {
        System.out.println("Select a valid option!!");
    }

    public void showReservationSucceededMessage() {
        System.out.println("Thank You! Enjoy the book.");
    }

    public void showReservationFailedMessage() {
        System.out.println("Sorry we don't have that book yet.");
    }

    public void showBookList(List<String> books) {
        for (int index = 0; index < books.size(); ++index) {
            System.out.println(String.format("#%d %s", index + 1, books.get(index)));
        }
    }

    public void showMovieList(Collection<Movie> movies) {
        System.out.println("Movie\tYear\tDirector\tRating");
        for (Movie movie : movies) {
            System.out.println(String.format("%s\t%d\t%s\t%s", movie.getTitle(), movie.getYear(), movie.getDirector(), movie.hasRating() ? movie.getRating() : "N/A"));
        }
    }

    public void prompt(String prompt) {
        System.out.print(prompt + " ");
    }

    public void showLoginRequiredMessage() {
        System.out.println("Please login first.");
    }

}
